Merge branch 'master' of http://git.xfoto.com.cn/Kodo/kodosale

FFIB 5 年之前
父節點
當前提交
6fbade4618
共有 12 個文件被更改,包括 151 次插入143 次删除
  1. 3 3
      account/admin.py
  2. 26 25
      account/models.py
  3. 67 59
      api/admin_views.py
  4. 1 3
      api/urls.py
  5. 3 3
      goods/models.py
  6. 5 5
      kodosale/basemodels.py
  7. 1 1
      kodosale/local_settings_bak.py
  8. 1 1
      kodosale/settings.py
  9. 1 1
      pay/admin.py
  10. 3 3
      pay/models.py
  11. 3 3
      pay/views.py
  12. 37 36
      utils/error/errno_utils.py

+ 3 - 3
account/admin.py

@@ -1,17 +1,17 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
+from django.conf import settings
3 4
 from django.contrib import admin
4 5
 from django.contrib.auth.hashers import make_password
5
-from django.conf import settings
6
-
7 6
 from pysnippets.strsnippets import strip
8 7
 
9
-from account.models import UserInfo, AdministratorInfo
8
+from account.models import AdministratorInfo, UserInfo
10 9
 
11 10
 
12 11
 class UserInfoAdmin(admin.ModelAdmin):
13 12
     list_display = ('user_id', 'unionid', 'openid', 'nickname', 'sex', 'avatar', 'phone', 'country', 'province', 'city', 'status', 'created_at', 'updated_at')
14 13
 
14
+
15 15
 class AdministratorInfoAdmin(admin.ModelAdmin):
16 16
     list_display = ('admin_id', 'admin_type', 'password', 'encryption', 'name', 'user_status', 'status', 'created_at', 'updated_at')
17 17
     list_filter = ('admin_type', 'user_status', 'status')

+ 26 - 25
account/models.py

@@ -12,18 +12,18 @@ class UserInfo(BaseModelMixin):
12 12
     unionid = models.CharField(_('unionid'), max_length=32, blank=True, null=True, help_text='微信 Unionid', db_index=True, unique=True)
13 13
     openid = models.CharField(_('openid'), max_length=32, blank=True, null=True, help_text='微信 Openid', db_index=True, unique=True)
14 14
     # 基本信息
15
-    nickname = models.CharField(_(u'nickname'), max_length=255, blank=True, null=True, help_text=u'用户昵称')
16
-    sex = models.IntegerField(_(u'sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.UNKNOWN, help_text=u'用户性别')
17
-    avatar = models.CharField(_(u'avatar'), max_length=255, blank=True, null=True, help_text=u'用户头像')
18
-    phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'用户电话', db_index=True)
19
-    country = models.CharField(_(u'country'), max_length=255, blank=True, null=True, help_text=u'用户国家')
20
-    province = models.CharField(_(u'province'), max_length=255, blank=True, null=True, help_text=u'用户省份')
21
-    city = models.CharField(_(u'city'), max_length=255, blank=True, null=True, help_text=u'用户城市')
22
-
23
-    #收货信息
24
-    consignee_name = models.CharField(_(u'consignee_name'), max_length=255, blank=True, null=True, help_text=u'收货人姓名')
25
-    consignee_phone = models.CharField(_(u'consignee_phone'), max_length=255, blank=True, null=True, help_text=u'收货人电话')
26
-    consignee_address = models.CharField(_(u'consignee_address'), max_length=255, blank=True, null=True, help_text=u'收货人地址')
15
+    nickname = models.CharField(_('nickname'), max_length=255, blank=True, null=True, help_text='用户昵称')
16
+    sex = models.IntegerField(_('sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.UNKNOWN, help_text='用户性别')
17
+    avatar = models.CharField(_('avatar'), max_length=255, blank=True, null=True, help_text='用户头像')
18
+    phone = models.CharField(_('phone'), max_length=11, blank=True, null=True, help_text='用户电话', db_index=True)
19
+    country = models.CharField(_('country'), max_length=255, blank=True, null=True, help_text='用户国家')
20
+    province = models.CharField(_('province'), max_length=255, blank=True, null=True, help_text='用户省份')
21
+    city = models.CharField(_('city'), max_length=255, blank=True, null=True, help_text='用户城市')
22
+
23
+    # 收货信息
24
+    consignee_name = models.CharField(_('consignee_name'), max_length=255, blank=True, null=True, help_text='收货人姓名')
25
+    consignee_phone = models.CharField(_('consignee_phone'), max_length=255, blank=True, null=True, help_text='收货人电话')
26
+    consignee_address = models.CharField(_('consignee_address'), max_length=255, blank=True, null=True, help_text='收货人地址')
27 27
 
28 28
     class Meta:
29 29
         verbose_name = _('用户信息')
@@ -57,11 +57,12 @@ class UserInfo(BaseModelMixin):
57 57
             'avatar': self.avatar,
58 58
         }
59 59
 
60
+
60 61
 class AdministratorInfo(BaseModelMixin):
61 62
     ADMINISTRATOR = 0
62 63
 
63 64
     USER_TYPE_TUPLE = (
64
-        (ADMINISTRATOR, u'管理员'),
65
+        (ADMINISTRATOR, '管理员'),
65 66
     )
66 67
 
67 68
     ACTIVATED = 1
@@ -69,24 +70,24 @@ class AdministratorInfo(BaseModelMixin):
69 70
     DELETED = 3
70 71
 
71 72
     USER_STATUS_TUPLE = (
72
-        (ACTIVATED, u'已激活'),
73
-        (DISABLED, u'已禁用'),
74
-        (DELETED, u'已删除'),
73
+        (ACTIVATED, '已激活'),
74
+        (DISABLED, '已禁用'),
75
+        (DELETED, '已删除'),
75 76
     )
76 77
 
77
-    admin_id = ShortUUIDField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'管理员唯一标识', db_index=True, unique=True)
78
+    admin_id = ShortUUIDField(_('admin_id'), max_length=32, blank=True, null=True, help_text='管理员唯一标识', db_index=True, unique=True)
78 79
 
79
-    admin_type = models.IntegerField(_(u'admin_type'), choices=USER_TYPE_TUPLE, default=ADMINISTRATOR, help_text=u'管理员类型', db_index=True)
80
+    admin_type = models.IntegerField(_('admin_type'), choices=USER_TYPE_TUPLE, default=ADMINISTRATOR, help_text='管理员类型', db_index=True)
80 81
 
81
-    name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'管理员名称')
82
-    password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'管理员密码')
83
-    encryption = models.CharField(_(u'encryption'), max_length=255, blank=True, null=True, help_text=u'管理员密码')
82
+    name = models.CharField(_('name'), max_length=255, blank=True, null=True, help_text='管理员名称')
83
+    password = models.CharField(_('password'), max_length=255, blank=True, null=True, help_text='管理员密码')
84
+    encryption = models.CharField(_('encryption'), max_length=255, blank=True, null=True, help_text='管理员密码')
84 85
 
85
-    user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS_TUPLE, default=ACTIVATED, help_text=u'管理员状态', db_index=True)
86
+    user_status = models.IntegerField(_('user_status'), choices=USER_STATUS_TUPLE, default=ACTIVATED, help_text='管理员状态', db_index=True)
86 87
 
87 88
     class Meta:
88
-        verbose_name = _(u'管理员信息')
89
-        verbose_name_plural = _(u'管理员信息')
89
+        verbose_name = _('管理员信息')
90
+        verbose_name_plural = _('管理员信息')
90 91
 
91 92
     def __unicode__(self):
92
-        return u'{}-{}'.format(self.name, self.phone)
93
+        return '{}-{}'.format(self.name, self.phone)

+ 67 - 59
api/admin_views.py

@@ -2,24 +2,23 @@
2 2
 
3 3
 import logging
4 4
 
5
-from django.conf import settings
5
+from django.contrib.auth.hashers import check_password
6 6
 from django.db import transaction
7
+from django.db.models import Q
7 8
 from django_logit import logit
8 9
 from django_response import response
9
-from django.contrib.auth.hashers import check_password
10
-from django.db.models import Q
11
-
12 10
 from TimeConvert import TimeConvert as tc
13 11
 
14
-from account.models import UserInfo, AdministratorInfo
12
+from account.models import AdministratorInfo
15 13
 from goods.models import GoodsInfo, PackInfo
16 14
 from kol.models import KOLInfo
17 15
 from pay.models import OrderInfo
16
+from utils.error.errno_utils import AdministratorStatusCode, OrderStatusCode
18 17
 
19
-from utils.error.errno_utils import AdministratorStatusCode
20 18
 
21 19
 logger = logging.getLogger('logit')
22 20
 
21
+
23 22
 @logit(res=True)
24 23
 def login(request):
25 24
     name = request.POST.get('name', '')
@@ -40,7 +39,7 @@ def login(request):
40 39
 
41 40
     request.session['admin_id'] = administrator.admin_id
42 41
 
43
-    return response(200, 'Admin Login Success', u'管理员登录成功', data={
42
+    return response(200, 'Admin Login Success', '管理员登录成功', data={
44 43
         'admin_id': administrator.admin_id,
45 44
         'admin_type': administrator.admin_type,
46 45
     })
@@ -49,60 +48,68 @@ def login(request):
49 48
 @logit(res=True)
50 49
 @transaction.atomic
51 50
 def order_list(request):
52
-  admin_id = request.POST.get('admin_id', '')
53
-  kol_id = request.POST.get('kol_id', '')
54
-  pack_id = request.POST.get('pack_id', '')
55
-  ftime = request.POST.get('ftime', '')
56
-  ttime = request.POST.get('ttime', '')
57
-  query = request.POST.get('query', '')
51
+    admin_id = request.POST.get('admin_id', '')
52
+    kol_id = request.POST.get('kol_id', '')
53
+    pack_id = request.POST.get('pack_id', '')
54
+    ftime = request.POST.get('ftime', '')
55
+    ttime = request.POST.get('ttime', '')
56
+    query = request.POST.get('query', '')
58 57
 
59
-  page = request.POST.get('page', 0)
60
-  num = request.POST.get('num', 20)
58
+    page = request.POST.get('page', 0)
59
+    num = request.POST.get('num', 20)
61 60
 
62
-  try:
63
-    administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True)
64
-  except AdministratorInfo.DoesNotExist:
65
-    return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND)
61
+    try:
62
+        administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True)
63
+    except AdministratorInfo.DoesNotExist:
64
+        return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND)
66 65
 
67
-  infos = OrderInfo.objects.filter(Q(phone__contains=query) | Q(name__contains=query) & Q(kol_id__contains=kol_id) & Q(pack_id__contains=pack_id)& Q(pay_status=1)).order_by('-paid_at')
66
+    infos = OrderInfo.objects.filter(
67
+        Q(phone__contains=query) | Q(name__contains=query) & Q(kol_id__contains=kol_id) & Q(
68
+            pack_id__contains=pack_id) & Q(pay_status=1)).order_by('-paid_at')
68 69
 
69
-  res = []
70
+    res = []
70 71
 
71
-  for info in infos:
72
-    goods_info = []
73
-    try:
74
-      pack = PackInfo.objects.get(pack_id=info.pack_id)
75
-      kol = KOLInfo.objects.get(kol_id=info.kol_id)
72
+    for info in infos:
73
+        goods_info = []
74
+        try:
75
+            pack = PackInfo.objects.get(pack_id=info.pack_id)
76
+        except PackInfo.DoesNotExist:
77
+            continue
76 78
 
77
-      for g in info.goods_info:
78 79
         try:
79
-          goods = GoodsInfo.objects.get(good_id=g.get('good_id', ''))
80
-          goods_info.append({
81
-            'title': goods.title,
82
-            'num': g.get('num', 0)
83
-          })
84
-        except:
85
-          continue
86
-      
87
-      res.append({
88
-        'name': info.name,
89
-        'phone': info.phone,
90
-        'address': info.address,
91
-        'paid_at': tc.local_string(utc_dt=info.paid_at, format='%Y-%m-%d %H:%M'),
92
-        'order_id': info.order_id,
93
-        'transaction_id': info.transaction_id,
94
-        'tracking_number': info.tracking_number,
95
-        'goods_info': goods_info,
96
-        'kol_name': kol.name,
97
-        'pack_title': pack.title
98
-      })
99
-    except:
100
-      continue
101
-  
102
-  return response(200, 'Order List Success', u'获取订单列表成功', {
80
+            kol = KOLInfo.objects.get(kol_id=info.kol_id)
81
+        except KOLInfo.DoesNotExist:
82
+            continue
83
+
84
+        for g in info.goods_info:
85
+            try:
86
+                goods = GoodsInfo.objects.get(good_id=g.get('good_id', ''))
87
+            except GoodsInfo.DoesNotExist:
88
+                continue
89
+
90
+            goods_info.append({
91
+                'title': goods.title,
92
+                'num': g.get('num', 0)
93
+            })
94
+
95
+        res.append({
96
+            'name': info.name,
97
+            'phone': info.phone,
98
+            'address': info.address,
99
+            'paid_at': tc.local_string(utc_dt=info.paid_at, format='%Y-%m-%d %H:%M'),
100
+            'order_id': info.order_id,
101
+            'transaction_id': info.transaction_id,
102
+            'tracking_number': info.tracking_number,
103
+            'goods_info': goods_info,
104
+            'kol_name': kol.name,
105
+            'pack_title': pack.title
106
+        })
107
+
108
+    return response(200, 'Order List Success', '获取订单列表成功', {
103 109
         'orders': res
104 110
     })
105 111
 
112
+
106 113
 @logit(res=True)
107 114
 @transaction.atomic
108 115
 def order_update(request):
@@ -111,15 +118,16 @@ def order_update(request):
111 118
     tracking_number = request.POST.get('tracking_number', '')
112 119
 
113 120
     try:
114
-      administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True)
121
+        administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True)
115 122
     except AdministratorInfo.DoesNotExist:
116
-      return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND)
123
+        return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND)
117 124
 
118 125
     try:
119
-      order = OrderInfo.objects.get(order_id=order_id)
120
-      order.tracking_number = tracking_number
121
-      order.save()
126
+        order = OrderInfo.objects.get(order_id=order_id)
122 127
     except OrderInfo.DoesNotExist:
123
-      return response(400001, 'Order Not Found', u'订单不存在')
124
-    
125
-    return response(200, 'Order Update Success', u'订单更新成功')
128
+        return response(OrderStatusCode.ORDER_NOT_FOUND)
129
+
130
+    order.tracking_number = tracking_number
131
+    order.save()
132
+
133
+    return response(200, 'Order Update Success', '订单更新成功')

+ 1 - 3
api/urls.py

@@ -2,7 +2,7 @@
2 2
 
3 3
 from django.conf.urls import url
4 4
 
5
-from api import mini_views, oauth_views, pack_views, admin_views
5
+from api import admin_views, mini_views, oauth_views, pack_views
6 6
 from pay import views as pay_views
7 7
 
8 8
 
@@ -27,8 +27,6 @@ urlpatterns += [
27 27
     url(r'^admin/order/update$', admin_views.order_update, name='order_update'),   # 订单列表
28 28
 ]
29 29
 
30
-
31
-
32 30
 urlpatterns += [
33 31
     url(r'^3rd/or$', oauth_views.oauth_redirect, name='3rd_or'),
34 32
     url(r'^3rd/oauth_redirect$', oauth_views.oauth_redirect, name='3rd_oauth_redirect'),

+ 3 - 3
goods/models.py

@@ -48,8 +48,8 @@ class GoodsInfo(BaseModelMixin):
48 48
 class PackInfo(BaseModelMixin):
49 49
     pack_id = ShortUUIDField(_('pack_id'), max_length=32, blank=True, null=True, help_text='包唯一标识', db_index=True, unique=True)
50 50
     title = models.CharField(_('title'), max_length=32, blank=True, null=True, help_text='标题', db_index=True)
51
-    expired_at = models.DateTimeField(_(u'expired_at'), blank=True, null=True, help_text=_(u'过期时间'))
52
-    pack_detail = RichTextField(_(u'pack_detail'), blank=True, null=True, help_text=u'包详情')
51
+    expired_at = models.DateTimeField(_('expired_at'), blank=True, null=True, help_text=_('过期时间'))
52
+    pack_detail = RichTextField(_('pack_detail'), blank=True, null=True, help_text='包详情')
53 53
     kol_id = models.CharField(_('kol_id'), max_length=32, blank=True, null=True, help_text='KOL 唯一标识', db_index=True)
54 54
 
55 55
     class Meta:
@@ -87,7 +87,7 @@ class PackGoodsInfo(BaseModelMixin):
87 87
             good = GoodsInfo.objects.get(good_id=self.good_id)
88 88
         except GoodsInfo.DoesNotExist:
89 89
             good = {}
90
-        
90
+
91 91
         data = good.data
92 92
         data.update({'inventory': self.inventory, 'has_sale_num': self.has_sale_num})
93 93
         return data

+ 5 - 5
kodosale/basemodels.py

@@ -5,9 +5,9 @@ from django.utils.translation import ugettext_lazy as _
5 5
 
6 6
 
7 7
 class BaseModelMixin(models.Model):
8
-    status = models.BooleanField(_(u'status'), default=True, help_text=_(u'状态'), db_index=True)
9
-    created_at = models.DateTimeField(_(u'created_at'), auto_now_add=True, editable=True, help_text=_(u'创建时间'))
10
-    updated_at = models.DateTimeField(_(u'updated_at'), auto_now=True, editable=True, help_text=_(u'更新时间'))
8
+    status = models.BooleanField(_('status'), default=True, help_text=_('状态'), db_index=True)
9
+    created_at = models.DateTimeField(_('created_at'), auto_now_add=True, editable=True, help_text=_('创建时间'))
10
+    updated_at = models.DateTimeField(_('updated_at'), auto_now=True, editable=True, help_text=_('更新时间'))
11 11
 
12 12
     class Meta:
13 13
         abstract = True
@@ -18,8 +18,8 @@ class SexChoicesMixin(models.Model):
18 18
     FEMALE = 0
19 19
 
20 20
     SEX_TYPE = (
21
-        (MALE, u'男'),
22
-        (FEMALE, u'女'),
21
+        (MALE, '男'),
22
+        (FEMALE, '女'),
23 23
     )
24 24
 
25 25
     class Meta:

+ 1 - 1
kodosale/local_settings_bak.py

@@ -14,4 +14,4 @@ EMAIL_HOST_USER = 'error.notify@exmail.com'
14 14
 EMAIL_HOST_PASSWORD = '<^_^>pwd<^_^>'
15 15
 DEFAULT_FROM_EMAIL = 'error.notify <error.notify@exmail.com>'
16 16
 ADMINS = [('Zhang San', 'san.zhang@exmail.com'), ('Li Si', 'si.li@exmail.com')]
17
-EMAIL_SUBJECT_PREFIX = u'[Templet] '
17
+EMAIL_SUBJECT_PREFIX = '[Templet] '

+ 1 - 1
kodosale/settings.py

@@ -302,7 +302,7 @@ ADMINS = [('Zhang San', 'san.zhang@exmail.com'), ('Li Si', 'si.li@exmail.com')]
302 302
 MANAGERS = ADMINS
303 303
 # Subject-line prefix for email messages send with django.core.mail.mail_admins
304 304
 # or ...mail_managers.  Make sure to include the trailing space.
305
-EMAIL_SUBJECT_PREFIX = u'[Templet] '
305
+EMAIL_SUBJECT_PREFIX = '[Templet] '
306 306
 
307 307
 # Django-Admin Settings
308 308
 DJANGO_ADMIN_DISABLE_DELETE_SELECTED = False

+ 1 - 1
pay/admin.py

@@ -1,7 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3 3
 from django.contrib import admin
4
-from django_admin import ReadOnlyModelAdmin, Readonly2ModelAdmin
4
+from django_admin import Readonly2ModelAdmin, ReadOnlyModelAdmin
5 5
 
6 6
 from pay.models import OrderInfo
7 7
 

+ 3 - 3
pay/models.py

@@ -29,7 +29,7 @@ class OrderInfo(BaseModelMixin):
29 29
         (WAITING_PAY, '待支付'),
30 30
         (PAID, '已支付'),
31 31
         (FAIL, '已失败'),
32
-        # (DELETED, u'已删除'),
32
+        # (DELETED, '已删除'),
33 33
     )
34 34
 
35 35
     order_id = ShortUUIDField(_('order_id'), max_length=32, help_text='订单唯一标识', db_index=True)
@@ -55,7 +55,7 @@ class OrderInfo(BaseModelMixin):
55 55
 
56 56
     trade_type = models.CharField(_('trade_type'), max_length=255, blank=True, null=True, help_text='支付方式')
57 57
 
58
-    pay_status = models.IntegerField(_('pay_status'), choices=PAY_STATUS, default=WAITING_PAY, help_text=u'支付状态', db_index=True)
58
+    pay_status = models.IntegerField(_('pay_status'), choices=PAY_STATUS, default=WAITING_PAY, help_text='支付状态', db_index=True)
59 59
     paid_at = models.DateTimeField(_('paid_at'), blank=True, null=True, help_text=_('支付时间'))
60 60
 
61 61
     reback_status = models.BooleanField(_('reback_status'), default=False, help_text='退款状态', db_index=True)
@@ -71,4 +71,4 @@ class OrderInfo(BaseModelMixin):
71 71
         verbose_name_plural = _('订单信息')
72 72
 
73 73
     def __unicode__(self):
74
-        return self.pk
74
+        return self.pk

+ 3 - 3
pay/views.py

@@ -76,7 +76,7 @@ def wx_order_create_api(request):
76 76
     for g in goods_info:
77 77
         try:
78 78
             good = GoodsInfo.objects.get(good_id=g.get('good_id', ''))
79
-        except:
79
+        except GoodsInfo.DoesNotExist:
80 80
             continue
81 81
         amount = amount + good.price * g.get('num', 0)
82 82
     
@@ -125,7 +125,7 @@ def wx_order_create_api(request):
125 125
     except WeChatPayException as e:
126 126
         order.unifiedorder_result = e.args
127 127
         order.save()
128
-        return response(OrderStatusCode.WX_UNIFIED_ORDER_FAIL)
128
+        return response(OrderStatusCode.UNIFIED_ORDER_FAIL)
129 129
 
130 130
     prepay_id = prepay_data.get('prepay_id', '')
131 131
     order.prepay_id = prepay_id
@@ -136,7 +136,7 @@ def wx_order_create_api(request):
136 136
     elif trade_type == 'APP':
137 137
         wxpay_params = wxpay.order.get_appapi_params(prepay_id)
138 138
 
139
-    return response(200, 'Order Create Success', u'订单创建成功', {
139
+    return response(200, 'Order Create Success', '订单创建成功', {
140 140
         'order_id': order.order_id,
141 141
         'prepay_id': prepay_id,
142 142
         'wxpay_params': wxpay_params,

+ 37 - 36
utils/error/errno_utils.py

@@ -2,64 +2,65 @@
2 2
 
3 3
 from StatusCode import BaseStatusCode, StatusCodeField
4 4
 
5
+
5 6
 class AdministratorStatusCode(BaseStatusCode):
6 7
     """ 操作员相关错误码 4002xx """
7
-    ADMINISTRATOR_NOT_FOUND = StatusCodeField(400201, 'Administrator Not Found', description=u'管理员不存在')
8
+    ADMINISTRATOR_NOT_FOUND = StatusCodeField(400201, 'Administrator Not Found', description='管理员不存在')
8 9
     # 密码
9
-    ADMINISTRATOR_PASSWORD_ERROR = StatusCodeField(400202, 'Administrator Password Error', description=u'管理员密码错误')
10
+    ADMINISTRATOR_PASSWORD_ERROR = StatusCodeField(400202, 'Administrator Password Error', description='管理员密码错误')
10 11
     # 用户名
11
-    ADMINISTRATOR_NAME_ALREADY_EXISTS = StatusCodeField(400205, 'Administrator Name Already Exists', description=u'管理员手机号已经存在')
12
+    ADMINISTRATOR_NAME_ALREADY_EXISTS = StatusCodeField(400205, 'Administrator Name Already Exists', description='管理员手机号已经存在')
12 13
     # 状态
13
-    ADMINISTRATOR_NOT_ACTIVATED = StatusCodeField(400215, 'Administrator Not Activated', description=u'管理员未激活')
14
-    ADMINISTRATOR_HAS_DISABLED = StatusCodeField(400216, 'Administrator Has Disabled', description=u'管理员已禁用')
15
-    ADMINISTRATOR_HAS_DELETED = StatusCodeField(400217, 'Administrator Has Deleted', description=u'管理员已删除')
14
+    ADMINISTRATOR_NOT_ACTIVATED = StatusCodeField(400215, 'Administrator Not Activated', description='管理员未激活')
15
+    ADMINISTRATOR_HAS_DISABLED = StatusCodeField(400216, 'Administrator Has Disabled', description='管理员已禁用')
16
+    ADMINISTRATOR_HAS_DELETED = StatusCodeField(400217, 'Administrator Has Deleted', description='管理员已删除')
17
+
16 18
 
17 19
 class ParamStatusCode(BaseStatusCode):
18 20
     """ 4000xx 参数相关错误码 """
19
-    PARAM_NOT_FOUND = StatusCodeField(400000, 'Param Not Found', description=u'参数不存在')
21
+    PARAM_NOT_FOUND = StatusCodeField(400000, 'Param Not Found', description='参数不存在')
20 22
 
21 23
 
22 24
 class ProfileStatusCode(BaseStatusCode):
23 25
     """ 4001xx 用户相关错误码 """
24
-    PROFILE_NOT_FOUND = StatusCodeField(400101, 'Profile Not Found', description=u'用户不存在')
26
+    PROFILE_NOT_FOUND = StatusCodeField(400101, 'Profile Not Found', description='用户不存在')
25 27
 
26 28
 
27 29
 class PhoneStatusCode(BaseStatusCode):
28 30
     """ 4002xx 手机相关错误码 """
29
-    INVALID_PHONE = StatusCodeField(400200, 'Invalid Phone', description=u'非法手机号')
30
-    PHONE_NOT_FOUND = StatusCodeField(400201, 'Phone Not Found', description=u'手机号不存在')
31
-    PHONE_ALREADY_EXISTS = StatusCodeField(400202, 'Phone Already Exists', description=u'手机号已存在')
31
+    INVALID_PHONE = StatusCodeField(400200, 'Invalid Phone', description='非法手机号')
32
+    PHONE_NOT_FOUND = StatusCodeField(400201, 'Phone Not Found', description='手机号不存在')
33
+    PHONE_ALREADY_EXISTS = StatusCodeField(400202, 'Phone Already Exists', description='手机号已存在')
32 34
 
33 35
 
34 36
 class UserStatusCode(BaseStatusCode):
35
-    USER_NOT_FOUND = StatusCodeField(400301, 'User Not Found', description=u'用户不存在')
37
+    USER_NOT_FOUND = StatusCodeField(400301, 'User Not Found', description='用户不存在')
36 38
 
37 39
 
38 40
 class KOLStatusCode(BaseStatusCode):
39
-    KOL_NOT_FOUND = StatusCodeField(401001, 'KOL Not Found', description=u'KOL不存在')
41
+    KOL_NOT_FOUND = StatusCodeField(401001, 'KOL Not Found', description='KOL不存在')
40 42
 
41 43
 
42 44
 class PackStatusCode(BaseStatusCode):
43
-    PACK_NOT_FOUND = StatusCodeField(402001, 'Pack Not Found', description=u'包不存在')
45
+    PACK_NOT_FOUND = StatusCodeField(402001, 'Pack Not Found', description='包不存在')
44 46
 
45 47
 
46 48
 class PackGoodsStatusCode(BaseStatusCode):
47
-    PACK_GOODS_NOT_FOUND = StatusCodeField(403001, 'Pack Goods Not Found', description=u'包商品不存在')
48
-    PACK_GOODS_INVENTORY_SHORTAGE = StatusCodeField(403002, 'Pack Goods Inventory Shortage', description=u'库存不足')
49
-
49
+    PACK_GOODS_NOT_FOUND = StatusCodeField(403001, 'Pack Goods Not Found', description='包商品不存在')
50
+    PACK_GOODS_INVENTORY_SHORTAGE = StatusCodeField(403002, 'Pack Goods Inventory Shortage', description='库存不足')
50 51
 
51 52
 
52 53
 class OrderStatusCode(BaseStatusCode):
53 54
     """ 4040xx 订单/支付相关错误码 """
54
-    UNIFIED_ORDER_FAIL = StatusCodeField(404000, 'Unified Order Fail', description=u'统一下单失败')
55
-    ORDER_NOT_FOUND = StatusCodeField(404001, 'Order Not Found', description=u'订单不存在')
55
+    UNIFIED_ORDER_FAIL = StatusCodeField(404000, 'Unified Order Fail', description='统一下单失败')
56
+    ORDER_NOT_FOUND = StatusCodeField(404001, 'Order Not Found', description='订单不存在')
56 57
     # 订单支付状态
57
-    ORDER_NOT_PAY = StatusCodeField(404011, 'Order Not Pay', description=u'订单未支付')
58
-    ORDER_PAYING = StatusCodeField(404012, 'Order Paying', description=u'订单支付中')
59
-    ORDER_PAY_FAIL = StatusCodeField(404013, 'Order Pay Fail', description=u'微信支付失败')
58
+    ORDER_NOT_PAY = StatusCodeField(404011, 'Order Not Pay', description='订单未支付')
59
+    ORDER_PAYING = StatusCodeField(404012, 'Order Paying', description='订单支付中')
60
+    ORDER_PAY_FAIL = StatusCodeField(404013, 'Order Pay Fail', description='微信支付失败')
60 61
     # 通知校验状态
61
-    SIGN_CHECK_FAIL = StatusCodeField(404090, 'Sign Check Fail', description=u'签名校验失败')
62
-    FEE_CHECK_FAIL = StatusCodeField(404091, 'FEE Check Fail', description=u'金额校验失败')
62
+    SIGN_CHECK_FAIL = StatusCodeField(404090, 'Sign Check Fail', description='签名校验失败')
63
+    FEE_CHECK_FAIL = StatusCodeField(404091, 'FEE Check Fail', description='金额校验失败')
63 64
 
64 65
 
65 66
 class PayStatusCode(BaseStatusCode):
@@ -68,39 +69,39 @@ class PayStatusCode(BaseStatusCode):
68 69
 
69 70
 class WithdrawStatusCode(BaseStatusCode):
70 71
     """ 4042xx 提现相关错误码 """
71
-    BALANCE_INSUFFICIENT = StatusCodeField(404200, 'Balance Insufficient', description=u'提现金额不足')
72
+    BALANCE_INSUFFICIENT = StatusCodeField(404200, 'Balance Insufficient', description='提现金额不足')
72 73
 
73 74
 
74 75
 class TokenStatusCode(BaseStatusCode):
75 76
     """ 4090xx 票据相关错误码 """
76
-    TOKEN_NOT_FOUND = StatusCodeField(409001, 'Token Not Found', description=u'票据不存在')
77
+    TOKEN_NOT_FOUND = StatusCodeField(409001, 'Token Not Found', description='票据不存在')
77 78
 
78 79
 
79 80
 class SignatureStatusCode(BaseStatusCode):
80 81
     """ 4091xx 签名校验错误 """
81
-    SIGNATURE_ERROR = StatusCodeField(409101, 'Signature Error', description=u'签名错误')
82
+    SIGNATURE_ERROR = StatusCodeField(409101, 'Signature Error', description='签名错误')
82 83
 
83 84
 
84 85
 class GVCodeStatusCode(BaseStatusCode):
85 86
     """ 4092xx 图形验证码相关错误码 """
86
-    GRAPHIC_VCODE_ERROR = StatusCodeField(409201, 'Graphic VCode Error', description=u'图形验证码错误')
87
+    GRAPHIC_VCODE_ERROR = StatusCodeField(409201, 'Graphic VCode Error', description='图形验证码错误')
87 88
 
88 89
 
89 90
 class SVCodeStatusCode(BaseStatusCode):
90 91
     """ 4093xx 短信验证码相关错误码 """
91
-    SMS_QUOTA_LIMIT = StatusCodeField(409300, 'SMS Quota Limit', description=u'短信次数超限')
92
-    SMS_VCODE_ERROR = StatusCodeField(409301, 'SMS VCode Error', description=u'验证码错误,请稍后重试')
93
-    SMS_VCODE_HAS_SEND = StatusCodeField(409302, 'SMS VCode Has Send', description=u'验证码已发送,请勿重复获取')
92
+    SMS_QUOTA_LIMIT = StatusCodeField(409300, 'SMS Quota Limit', description='短信次数超限')
93
+    SMS_VCODE_ERROR = StatusCodeField(409301, 'SMS VCode Error', description='验证码错误,请稍后重试')
94
+    SMS_VCODE_HAS_SEND = StatusCodeField(409302, 'SMS VCode Has Send', description='验证码已发送,请勿重复获取')
94 95
 
95 96
 
96 97
 class InsufficientStatusCode(BaseStatusCode):
97 98
     """ 4095xx 不足相关错误码 """
98
-    BALANCE_INSUFFICIENT = StatusCodeField(409501, 'Balance Insufficient', description=u'余额不足')
99
-    INTEGRAL_INSUFFICIENT = StatusCodeField(409502, 'Integral Insufficient', description=u'积分不足')
99
+    BALANCE_INSUFFICIENT = StatusCodeField(409501, 'Balance Insufficient', description='余额不足')
100
+    INTEGRAL_INSUFFICIENT = StatusCodeField(409502, 'Integral Insufficient', description='积分不足')
100 101
 
101 102
 
102 103
 class PermissionStatusCode(BaseStatusCode):
103 104
     """ 4099xx 权限相关错误码 """
104
-    PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description=u'权限不足')
105
-    UPLOAD_PERMISSION_DENIED = StatusCodeField(409910, 'Upload Permission Denied', description=u'上传权限不足')
106
-    UPDATE_PERMISSION_DENIED = StatusCodeField(409930, 'Update Permission Denied', description=u'更新权限不足')
105
+    PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description='权限不足')
106
+    UPLOAD_PERMISSION_DENIED = StatusCodeField(409910, 'Upload Permission Denied', description='上传权限不足')
107
+    UPDATE_PERMISSION_DENIED = StatusCodeField(409930, 'Update Permission Denied', description='更新权限不足')